ig.module(
	'game.entities.base.baseSheep'
)
.requires(
	'impact.entity',
	'game.entities.base.pickObject'	
)
.defines(function()
{
    EntityBaseSheep = EntityPickObject.extend(
    {
        size: {x:43, y:27},	
        animSheet: new ig.AnimationSheet('media/pickInside/texture_blueSheep.png', 43, 27),
	font: new ig.Font( 'media/fonts/arialRounded.png' ),	
        bounciness: 1,
	pickType: 'all',
	number: 1,
	
	init: function(x, y, settings)
	{
	    this.parent(x, y, settings);
	    this.addAnim('Idle', 0.3, [0, 1]);
	},
	
	update: function()
	{
	    this.parent();
	    
	    if (this.vel.x > 0)
	    {
		this.currentAnim.flip.x = true;
	    }
	    else if (this.vel.x < 0)
	    {
		this.currentAnim.flip.x = false;		
	    }
	},
	
	draw: function()
	{
	    this.parent();
	    this.font.draw( '' + this.number, this.pos.x + 15, this.pos.y + 2, ig.Font.ALIGN.LEFT );
	},
	
	onPick: function()
	{
	    switch (ig.global.mathOperator)
	    {
		case '+':
		    {
			ig.global.currentValue += this.number;
			
			if (ig.global.currentValue > ig.global.desiredValue)
			{
			    ig.global.failed = true;
			}
		    }
		    break;
		
		case '-':
		    {
			ig.global.currentValue -= this.number;

			if (ig.global.currentValue < ig.global.desiredValue)
			{
			    ig.global.failed = true;
			}
		    }
		    break;
		
		case '*':
		    {
			ig.global.currentValue *= this.number;			
		    }
		    break;
		
		case '/':
		    {
			ig.global.currentValue /= this.number;			
		    }
		    break;		
	    }
	    
	    this.parent();	    
	}
    });
});